package com.hjxr.sysadmin.zsj.controller;

import java.util.List;

import com.hjxr.framework.web.domain.AjaxResult;
import com.hjxr.sysadmin.uitl.poi.ExcelUtil;
import com.hjxr.sysadmin.web.controller.BaseController;
import com.hjxr.sysadmin.web.page.TableDataInfo;
import com.hjxr.sysadmin.zsj.domain.Industrycompany;
import com.hjxr.sysadmin.zsj.service.IIndustrycompanyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.hjxr.framework.aspectj.lang.annotation.Log;
import com.hjxr.framework.aspectj.lang.enums.BusinessType;

/**
 * 明星产业企业Controller
 *
 * @author hjxr
 * @date 2021-03-22
 */
@Api("招商意向需求")

@RestController
@RequestMapping("/industrycompany")
public class IndustrycompanyController extends BaseController
{
    @Autowired
    private IIndustrycompanyService industrycompanyService;

    /**
     * 查询明星产业企业列表
     */
    @ApiOperation("查询明星产业企业列表")
    @GetMapping("/list")
    public TableDataInfo list(Industrycompany industrycompany)
    {
        startPage();
        List<Industrycompany> list = industrycompanyService.selectIndustrycompanyList(industrycompany);
        return getDataTable(list);
    }

    /**
     * 导出明星产业企业列表
     */
    @ApiOperation("导出明星产业企业列表")
    @Log(title = "明星产业企业", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(Industrycompany industrycompany)
    {
        List<Industrycompany> list = industrycompanyService.selectIndustrycompanyList(industrycompany);
        ExcelUtil<Industrycompany> util = new ExcelUtil<Industrycompany>(Industrycompany.class);
        return util.exportExcel(list, "industrycompany");
    }

    /**
     * 获取明星产业企业详细信息
     */
    @ApiOperation("获取明星产业企业详细信息")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(industrycompanyService.selectIndustrycompanyById(id));
    }

    /**
     * 新增明星产业企业
     */
    @ApiOperation("新增明星产业企业")
    @Log(title = "明星产业企业", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Industrycompany industrycompany)
    {
        return toAjax(industrycompanyService.insertIndustrycompany(industrycompany));
    }

    /**
     * 修改明星产业企业
     */
    @ApiOperation("修改明星产业企业")
    @Log(title = "明星产业企业", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Industrycompany industrycompany)
    {
        return toAjax(industrycompanyService.updateIndustrycompany(industrycompany));
    }

    /**
     * 删除明星产业企业
     */
    @ApiOperation("删除明星产业企业")
    @Log(title = "明星产业企业", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(industrycompanyService.deleteIndustrycompanyByIds(ids));
    }
}
